<?php
$this->headLink()->appendStylesheet("/css/journal.css");
if(isset($this->journals)) {
	foreach($this->journals as $j) {
		$comments_count = $j->comments_count == 1? "$j->comments_count comment" : "$j->comments_count comments";
		$published = date('M jS, Y',$j->published);
	?>
		<div id='post-<?php print $j->id; ?>'>
			<h2><a href='/journal/<?php print $j->url; ?>'><?php print $j->title; ?></a></h2>
			<ul class="postmetadata">
				<li class="author">By <?php print $j->author->name; ?></li>
				<li><?php print $published; ?></li>
				<li class='comments'><a href="/journal/<?php print $j->url; ?>/#comments"><?php print $comments_count; ?></a></li>
			</ul>
			<div class='entry'>
				<?php print $j->content; ?>
			</div>
			<a class="continue-reading" href="/journal/<?php print $j->url; ?>/">Read more...</a>
		</div>
<?php
	}
} else if(isset($this->journal)) {
	$j = $this->journal;
	$comments_count = $j->comments_count == 1? "$j->comments_count comment" : "$j->comments_count comments";
	$published = date('M jS, Y',$j->published);
?>
	<div id='post-<?php print $j->id; ?>'>
			<h2><a href='/journal/<?php print $j->url; ?>'><?php print $j->title; ?></a></h2>
			<ul class="postmetadata">
				<li class="author">By <?php print $j->author->name; ?></li>
				<li><?php print $published; ?></li>
				<li class='comments'><a href="/journal/<?php print $j->url; ?>/#comments"><?php print $comments_count; ?></a></li>
			</ul>
			<div class='entry'>
				<?php print $j->content; ?>
			</div>
	</div>
<?php } else { ?>
	<div class='center construction'>
		<h2>Under Construction</h2>
		<img src='/images/construction.png'></img>
		<p>Please check back later.</p>
	</div>
<?php } ?>